<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子2-ES6/7常用语法介绍</title>
    </head>
    <body>
        <pre>
            <code>
                // 例子2

                var a = [];
                for(var i = 0; i < 10; i++) {
                    a[i] = function() {
                        console.log(i);
                    }
                }

                a[6](); // 10

                //-------------------------------------------------

                var a = [];
                for(let i = 0; i < 10; i++) {
                    a[i] = function() {
                        console.log(i);
                    }
                }

                a[6](); // 6
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/2.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>